import time

import allure


def add_img_2_report(driver, step_name, sleep_sec: float = 2):
    if sleep_sec > 0:
        time.sleep(sleep_sec)
    allure.attach(
        driver.get_screenshot_as_png(),
        name=f"{step_name}.png",
        attachment_type=allure.attachment_type.PNG
    )
